package com.huijutao.beans;

import android.text.TextUtils;

import com.alibaba.fastjson.JSON;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.List;

/**
 * 团购的bean
 */
public class GroupItem implements Serializable{
    private String id;
    private String title;
    private String brand_id;
    private String go_url;
    private String memo;
    private int attend_count;
    private int price;
    private int original_price;
    private String discount;
    private long time;
    private String single;
    private String img_path;

    public static List<GroupItem> getListFromJsonStr(String jsonStr) {
        try {
            JSONObject jsonObject = new JSONObject(jsonStr);
            if ("ok".equals(jsonObject.optString("msg")) &&
                    !TextUtils.isEmpty(jsonObject.optString("data"))) {
                return JSON.parseArray(jsonObject.optString("data"), GroupItem.class);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return null;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getBrand_id() {
        return brand_id;
    }

    public void setBrand_id(String brand_id) {
        this.brand_id = brand_id;
    }

    public String getGo_url() {
        return go_url;
    }

    public void setGo_url(String go_url) {
        this.go_url = go_url;
    }

    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public int getAttend_count() {
        return attend_count;
    }

    public void setAttend_count(int attend_count) {
        this.attend_count = attend_count;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public int getOriginal_price() {
        return original_price;
    }

    public void setOriginal_price(int original_price) {
        this.original_price = original_price;
    }

    public String getDiscount() {
        return discount;
    }

    public void setDiscount(String discount) {
        this.discount = discount;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public String getSingle() {
        return single;
    }

    public void setSingle(String single) {
        this.single = single;
    }

    public String getImg_path() {
        return img_path;
    }

    public void setImg_path(String img_path) {
        this.img_path = img_path;
    }
}
